<template>
  <div class="left-container">
    <h3>left组件</h3>
    <hr />
    <MyCount :init="9"></MyCount>
    <hr />
    <h3>父向子传递参数</h3>
    <p>msg的值：{{ msg }}</p>
    <p>user的值：{{ user }}</p>
    <hr />
    <button @click="send">发送给兄弟组件</button>
  </div>
</template>

<script>
import bus from "./eventBus.js";

export default {
  props: ["msg", "user"],
  data() {
    return {
      str: "兄弟组件之间的共享",
    };
  },
  methods: {
    send() {
      bus.$emit("share", this.str);
    },
  },
};
</script>

<!-- scoped会自动添加属性标签 -->
<style lang="less" scoped>
.left-container {
  background-color: red;
  min-height: 250px;
  flex: 1;
}
</style>
